package cn.com.youjile.task;

import cn.com.youjile.server.GeneralServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author youjile
 * @CreateDate 2021/3/12
 * @Describe 定时任务，定时打印连接缓存信息
 */
@Component
public class CacheCheckTask {

    private boolean isPrintCacheTask = true;

    private static final Logger logger = LoggerFactory.getLogger(CacheCheckTask.class);

    @Scheduled(cron = "0/5 * * * * ?") //每5秒执行一次
    public void ckeckXEConnectStatus(){
        if(isPrintCacheTask) {
            logger.debug("开始打印缓存：");
            logger.debug("all channel : XcloudServer.allChannels.size() = " + GeneralServer.allChannels.size());
            logger.debug("结束打印缓存。");
        }
    }

}
